package com.nwu.user.mapper;



import com.nwu.user.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LoginMapper {
    @Select("select *from `psy-user`.user where username = #{username}")
    User getByUserName(String username);
    @Select("select *from `psy-user`.user where id = #{userId}")
    User getByUserId(Long userId);

    @Select("select role_name from `psy-user`.role\n" +
            "left join `psy-user`.role_user ru on role.id = ru.role_id\n" +
            "where ru.user_id =#{id}")
    List<String> getRoleById(Long id);
}
